# Contributor: Grigory Kirillov <txgk@bk.ru>
# Maintainer:
pkgname=plfit
pkgver=0.9.4
pkgrel=2
pkgdesc="Tool for fitting power-law distributions to empirical data"
url="https://github.com/ntamas/plfit"
arch="all"
license="GPL-2.0-only"
makedepends="cmake samurai"
subpackages="$pkgname-static $pkgname-libs $pkgname-dev"
source="https://github.com/ntamas/plfit/archive/$pkgver/plfit-$pkgver.tar.gz"

build() {
	cmake -B builddir -G Ninja \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_BUILD_TYPE=Release \
		-DBUILD_SHARED_LIBS=ON
	cmake -B builddir-static -G Ninja \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_BUILD_TYPE=Release
	cmake --build builddir
	cmake --build builddir-static
}

check() {
	ctest --output-on-failure --test-dir builddir
}

package() {
	# Install static build first because we want the utilities to be linked dynamically.
	DESTDIR="$pkgdir" cmake --install builddir-static
	DESTDIR="$pkgdir" cmake --install builddir
}

sha512sums="
39cb644de20645b35b8ce6f95bb074276314f5fdc755e0d7eba8e69d1f0d65b784cd755b7a4481e933f8863c30f6b2957e7dba45fc9a695cef14ad4fef729885  plfit-0.9.4.tar.gz
"
